#pragma once

#ifdef _WINDOWS
#include "Win32DemoApplication.h"
#define PlatformDemoApplication Win32DemoApplication
#else
#include "GlutDemoApplication.h"
#define PlatformDemoApplication GlutDemoApplication
#endif

#include "LinearMath/btAlignedObjectArray.h"

#include "Magnet.h"
#include "ParticleSystem.h"

class btBroadphaseInterface;
class btCollisionShape;
class btOverlappingPairCache;
class btCollisionDispatcher;
class btConstraintSolver;
struct btCollisionAlgorithmCreateFunc;
class btDefaultCollisionConfiguration;

class MagnetInMotion : public PlatformDemoApplication {
	
	btAlignedObjectArray<btCollisionShape*>	m_collisionShapes;

	btBroadphaseInterface*	m_broadphase;

	btCollisionDispatcher*	m_dispatcher;

	btConstraintSolver*	m_solver;

	btDefaultCollisionConfiguration* m_collisionConfiguration;

	ParticleSystem *particleSystem;

	public:

	MagnetInMotion()
	{
	}
	virtual ~MagnetInMotion()
	{
		exitPhysics();
	}
	void	initPhysics();

	void	exitPhysics();

	virtual void clientMoveAndDisplay();

	virtual void displayCallback();
	virtual void	clientResetScene();
	
	static DemoApplication* Create()
	{
		MagnetInMotion* mim = new MagnetInMotion;
		mim->myinit();
		mim->initPhysics();
		return mim;
	}

	static void DrawMField(const btVector3& pos);
	/*
	btDynamicsWorld* getDynamicsWorld() {
		return m_dynamicsWorld;
	}

	btAlignedObjectArray<btCollisionShape*> getCollisionShapeList() {
		return m_collisionShapes;
	}*/
};